import request from '@/config/axios'

// 知识点分类 VO
export interface KnowledgeCateVO {
  id: number // ID
  name: string // 分类名称
  type: number // 类型
  pid: number // 上级
  price: number // 价格
}

// 知识点分类 API
export const KnowledgeCateApi = {
  // 查询知识点分类列表
  getKnowledgeCateList: async (params) => {
    return await request.get({ url: `/exam/knowledge-cate/list`, params })
  },

  // 查询知识点分类详情
  getKnowledgeCate: async (id: number) => {
    return await request.get({ url: `/exam/knowledge-cate/get?id=` + id })
  },

  // 新增知识点分类
  createKnowledgeCate: async (data: KnowledgeCateVO) => {
    return await request.post({ url: `/exam/knowledge-cate/create`, data })
  },

  // 修改知识点分类
  updateKnowledgeCate: async (data: KnowledgeCateVO) => {
    return await request.put({ url: `/exam/knowledge-cate/update`, data })
  },

  // 删除知识点分类
  deleteKnowledgeCate: async (id: number) => {
    return await request.delete({ url: `/exam/knowledge-cate/delete?id=` + id })
  },

  // 导出知识点分类 Excel
  exportKnowledgeCate: async (params) => {
    return await request.download({ url: `/exam/knowledge-cate/export-excel`, params })
  }
}